home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / OpenGL 1.0 SDK / Headers / agl.h next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  13.3 KB  |  303 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        agl.h
  3.  
  4.     Version:    1.0
  5.  
  6.     Copyright:    © 1999 by Apple Computer, Inc., all rights reserved.
  7. */
  8.  
  9. #ifndef _AGL_H
  10. #define _AGL_H
  11.  
  12. #include <Quickdraw.h>
  13. #include "gl.h"
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19.  
  20. /*
  21. ** AGL API version.
  22. */
  23. #define AGL_VERSION_2_0  1
  24.  
  25. /*
  26. ** Macintosh device type.
  27. */
  28. typedef GDHandle AGLDevice;
  29.  
  30. /*
  31. ** Macintosh drawable type.
  32. */
  33. typedef CGrafPtr AGLDrawable;
  34.  
  35. /*
  36. ** AGL opaque data.
  37. */
  38. typedef struct __AGLRendererInfoRec  *AGLRendererInfo;
  39. typedef struct __AGLPixelFormatRec   *AGLPixelFormat;
  40. typedef struct __AGLContextRec       *AGLContext;
  41.  
  42. /************************************************************************/
  43.  
  44. /*
  45. ** Attribute names for aglChoosePixelFormat and aglDescribePixelFormat.
  46. */
  47. #define AGL_NONE                   0
  48. #define AGL_ALL_RENDERERS          1  /* choose from all available renderers          */
  49. #define AGL_BUFFER_SIZE            2  /* depth of the index buffer                    */
  50. #define AGL_LEVEL                  3  /* level in plane stacking                      */
  51. #define AGL_RGBA                   4  /* choose an RGBA format                        */
  52. #define AGL_DOUBLEBUFFER           5  /* double buffering supported                   */
  53. #define AGL_STEREO                 6  /* stereo buffering supported                   */
  54. #define AGL_AUX_BUFFERS            7  /* number of aux buffers                        */
  55. #define AGL_RED_SIZE               8  /* number of red component bits                 */
  56. #define AGL_GREEN_SIZE             9  /* number of green component bits               */
  57. #define AGL_BLUE_SIZE             10  /* number of blue component bits                */
  58. #define AGL_ALPHA_SIZE            11  /* number of alpha component bits               */
  59. #define AGL_DEPTH_SIZE            12  /* number of depth bits                         */
  60. #define AGL_STENCIL_SIZE          13  /* number of stencil bits                       */
  61. #define AGL_ACCUM_RED_SIZE        14  /* number of red accum bits                     */
  62. #define AGL_ACCUM_GREEN_SIZE      15  /* number of green accum bits                   */
  63. #define AGL_ACCUM_BLUE_SIZE       16  /* number of blue accum bits                    */
  64. #define AGL_ACCUM_ALPHA_SIZE      17  /* number of alpha accum bits                   */
  65.  
  66. /*
  67. ** Extended attributes
  68. */
  69. #define AGL_PIXEL_SIZE            50  /* frame buffer bits per pixel                  */
  70. #define AGL_MINIMUM_POLICY        51  /* never choose smaller buffers than requested  */
  71. #define AGL_MAXIMUM_POLICY        52  /* choose largest buffers of type requested     */
  72. #define AGL_OFFSCREEN             53  /* choose an off-screen capable renderer        */
  73. #define AGL_FULLSCREEN            54  /* choose a full-screen capable renderer        */
  74. /* Renderer management */
  75. #define AGL_RENDERER_ID           70  /* request renderer by ID                       */
  76. #define AGL_SINGLE_RENDERER       71  /* choose a single renderer for all screens     */
  77. #define AGL_NO_RECOVERY           72  /* disable all failure recovery systems         */
  78. #define AGL_ACCELERATED           73  /* choose a hardware accelerated renderer       */
  79. #define AGL_CLOSEST_POLICY        74  /* choose the closest color buffer to request   */
  80. #define AGL_ROBUST                75  /* renderer does not need failure recovery      */
  81. #define AGL_BACKING_STORE         76  /* back buffer contents are valid after swap    */
  82. #define AGL_MP_SAFE               78  /* renderer is multi-processor safe             */
  83.  
  84. /*
  85. ** Only for aglDescribePixelFormat
  86. */
  87. #define AGL_WINDOW                80  /* can be used to render to an onscreen window  */
  88. #define AGL_MULTISCREEN           81  /* single window can span multiple screens      */
  89. #define AGL_VIRTUAL_SCREEN        82  /* virtual screen number                        */
  90. #define AGL_COMPLIANT             83  /* renderer is opengl compliant                 */
  91.  
  92. /*
  93. ** Property names for aglDescribeRenderer
  94. */
  95. /* #define AGL_OFFSCREEN          53 */
  96. /* #define AGL_FULLSCREEN         54 */
  97. /* #define AGL_RENDERER_ID        70 */
  98. /* #define AGL_ACCELERATED        73 */
  99. /* #define AGL_ROBUST             75 */
  100. /* #define AGL_BACKING_STORE      76 */
  101. /* #define AGL_MP_SAFE            78 */
  102. /* #define AGL_WINDOW             80 */
  103. /* #define AGL_MULTISCREEN        81 */
  104. /* #define AGL_COMPLIANT          83 */
  105. #define AGL_BUFFER_MODES         100
  106. #define AGL_MIN_LEVEL            101
  107. #define AGL_MAX_LEVEL            102
  108. #define AGL_COLOR_MODES          103
  109. #define AGL_ACCUM_MODES          104
  110. #define AGL_DEPTH_MODES          105
  111. #define AGL_STENCIL_MODES        106
  112. #define AGL_MAX_AUX_BUFFERS      107
  113. #define AGL_VIDEO_MEMORY         120
  114. #define AGL_TEXTURE_MEMORY       121
  115.  
  116. /*
  117. ** Integer parameter names
  118. */
  119. #define AGL_SWAP_RECT             200  /* Enable or set the swap rectangle              */
  120. #define AGL_BUFFER_RECT          202  /* Enable or set the buffer rectangle            */
  121. #define AGL_COLORMAP_TRACKING    210  /* Enable or disable colormap tracking           */
  122. #define AGL_COLORMAP_ENTRY       212  /* Set a colormap entry to {index, r, g, b}      */
  123. #define AGL_RASTERIZATION        220  /* Enable or disable all rasterization           */
  124. #define AGL_SWAP_INTERVAL        222  /* 0 -> Don't sync, n -> Sync every n retrace    */
  125. #define AGL_STATE_VALIDATION     230  /* Validate state for multi-screen functionality */
  126.  
  127. /*
  128. ** Option names for aglConfigure.
  129. */
  130. #define AGL_FORMAT_CACHE_SIZE    501  /* Set the size of the pixel format cache        */
  131. #define AGL_CLEAR_FORMAT_CACHE   502  /* Reset the pixel format cache                  */
  132. #define AGL_RETAIN_RENDERERS     503  /* Whether to retain loaded renderers in memory  */
  133.  
  134. /* buffer_modes */
  135. #define AGL_MONOSCOPIC_BIT       0x00000001
  136. #define AGL_STEREOSCOPIC_BIT     0x00000002
  137. #define AGL_SINGLEBUFFER_BIT     0x00000004
  138. #define AGL_DOUBLEBUFFER_BIT     0x00000008
  139.  
  140. /* bit depths */
  141. #define AGL_0_BIT                0x00000001
  142. #define AGL_1_BIT                0x00000002
  143. #define AGL_2_BIT                0x00000004
  144. #define AGL_3_BIT                0x00000008
  145. #define AGL_4_BIT                0x00000010
  146. #define AGL_5_BIT                0x00000020
  147. #define AGL_6_BIT                0x00000040
  148. #define AGL_8_BIT                0x00000080
  149. #define AGL_10_BIT               0x00000100
  150. #define AGL_12_BIT               0x00000200
  151. #define AGL_16_BIT               0x00000400
  152. #define AGL_24_BIT               0x00000800
  153. #define AGL_32_BIT               0x00001000
  154. #define AGL_48_BIT               0x00002000
  155. #define AGL_64_BIT               0x00004000
  156. #define AGL_96_BIT               0x00008000
  157. #define AGL_128_BIT              0x00010000
  158.  
  159. /* color modes */
  160. #define AGL_RGB8_BIT             0x00000001  /* 8 rgb bit/pixel,     RGB=7:0, inverse colormap         */
  161. #define AGL_RGB8_A8_BIT          0x00000002  /* 8-8 argb bit/pixel,  A=7:0, RGB=7:0, inverse colormap  */
  162. #define AGL_BGR233_BIT           0x00000004  /* 8 rgb bit/pixel,     B=7:6, G=5:3, R=2:0               */
  163. #define AGL_BGR233_A8_BIT        0x00000008  /* 8-8 argb bit/pixel,  A=7:0, B=7:6, G=5:3, R=2:0        */
  164. #define AGL_RGB332_BIT           0x00000010  /* 8 rgb bit/pixel,     R=7:5, G=4:2, B=1:0               */
  165. #define AGL_RGB332_A8_BIT        0x00000020  /* 8-8 argb bit/pixel,  A=7:0, R=7:5, G=4:2, B=1:0        */
  166. #define AGL_RGB444_BIT           0x00000040  /* 16 rgb bit/pixel,    R=11:8, G=7:4, B=3:0              */
  167. #define AGL_ARGB4444_BIT         0x00000080  /* 16 argb bit/pixel,   A=15:12, R=11:8, G=7:4, B=3:0     */
  168. #define AGL_RGB444_A8_BIT        0x00000100  /* 8-16 argb bit/pixel, A=7:0, R=11:8, G=7:4, B=3:0       */
  169. #define AGL_RGB555_BIT           0x00000200  /* 16 rgb bit/pixel,    R=14:10, G=9:5, B=4:0             */
  170. #define AGL_ARGB1555_BIT         0x00000400  /* 16 argb bit/pixel,   A=15, R=14:10, G=9:5, B=4:0       */
  171. #define AGL_RGB555_A8_BIT        0x00000800  /* 8-16 argb bit/pixel, A=7:0, R=14:10, G=9:5, B=4:0      */
  172. #define AGL_RGB565_BIT           0x00001000  /* 16 rgb bit/pixel,    R=15:11, G=10:5, B=4:0            */
  173. #define AGL_RGB565_A8_BIT        0x00002000  /* 8-16 argb bit/pixel, A=7:0, R=15:11, G=10:5, B=4:0     */
  174. #define AGL_RGB888_BIT           0x00004000  /* 32 rgb bit/pixel,    R=23:16, G=15:8, B=7:0            */
  175. #define AGL_ARGB8888_BIT         0x00008000  /* 32 argb bit/pixel,   A=31:24, R=23:16, G=15:8, B=7:0   */
  176. #define AGL_RGB888_A8_BIT        0x00010000  /* 8-32 argb bit/pixel, A=7:0, R=23:16, G=15:8, B=7:0     */
  177. #define AGL_RGB101010_BIT        0x00020000  /* 32 rgb bit/pixel,    R=29:20, G=19:10, B=9:0           */
  178. #define AGL_ARGB2101010_BIT      0x00040000  /* 32 argb bit/pixel,   A=31:30  R=29:20, G=19:10, B=9:0  */
  179. #define AGL_RGB101010_A8_BIT     0x00080000  /* 8-32 argb bit/pixel, A=7:0  R=29:20, G=19:10, B=9:0  */
  180. #define AGL_RGB121212_BIT        0x00100000  /* 48 rgb bit/pixel,    R=35:24, G=23:12, B=11:0          */
  181. #define AGL_ARGB12121212_BIT     0x00200000  /* 48 argb bit/pixel,   A=47:36, R=35:24, G=23:12, B=11:0 */
  182. #define AGL_RGB161616_BIT        0x00400000  /* 64 rgb bit/pixel,    R=47:32, G=31:16, B=15:0          */
  183. #define AGL_ARGB16161616_BIT     0x00800000  /* 64 argb bit/pixel,   A=63:48, R=47:32, G=31:16, B=15:0 */
  184. #define AGL_INDEX8_BIT           0x20000000  /* 8 bit color look up table                              */
  185. #define AGL_INDEX16_BIT          0x40000000  /* 16 bit color look up table                             */
  186.  
  187. /*
  188. ** Error return values from aglGetError.
  189. */
  190. #define AGL_NO_ERROR                 0 /* no error                        */
  191.  
  192. #define AGL_BAD_ATTRIBUTE        10000 /* invalid pixel format attribute  */
  193. #define AGL_BAD_PROPERTY         10001 /* invalid renderer property       */
  194. #define AGL_BAD_PIXELFMT         10002 /* invalid pixel format            */
  195. #define AGL_BAD_RENDINFO         10003 /* invalid renderer info           */
  196. #define AGL_BAD_CONTEXT          10004 /* invalid context                 */
  197. #define AGL_BAD_DRAWABLE         10005 /* invalid drawable                */
  198. #define AGL_BAD_GDEV             10006 /* invalid graphics device         */
  199. #define AGL_BAD_STATE            10007 /* invalid context state           */
  200. #define AGL_BAD_VALUE            10008 /* invalid numerical value         */
  201. #define AGL_BAD_MATCH            10009 /* invalid share context           */
  202. #define AGL_BAD_ENUM             10010 /* invalid enumerant               */
  203. #define AGL_BAD_OFFSCREEN        10011 /* invalid offscreen drawable      */
  204. #define AGL_BAD_FULLSCREEN       10012 /* invalid offscreen drawable      */
  205. #define AGL_BAD_WINDOW           10013 /* invalid window                  */
  206. #define AGL_BAD_POINTER          10014 /* invalid pointer                 */
  207. #define AGL_BAD_MODULE           10015 /* invalid code module             */
  208. #define AGL_BAD_ALLOC            10016 /* memory allocation failure       */
  209.  
  210. /************************************************************************/
  211.  
  212. /*
  213. ** Pixel format functions
  214. */
  215. extern AGLPixelFormat aglChoosePixelFormat(const AGLDevice *gdevs, GLint ndev, const GLint *attribs);
  216. extern void aglDestroyPixelFormat(AGLPixelFormat pix);
  217. extern AGLPixelFormat aglNextPixelFormat(AGLPixelFormat pix);
  218. extern GLboolean aglDescribePixelFormat(AGLPixelFormat pix, GLint attrib, GLint *value);
  219. extern AGLDevice *aglDevicesOfPixelFormat(AGLPixelFormat pix, GLint *ndevs);
  220.  
  221. /*
  222. ** Renderer information functions
  223. */
  224. extern AGLRendererInfo aglQueryRendererInfo(const AGLDevice *gdevs, GLint ndev);
  225. extern void aglDestroyRendererInfo(AGLRendererInfo rend);
  226. extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend);
  227. extern GLboolean aglDescribeRenderer(AGLRendererInfo rend, GLint prop, GLint *value);
  228.  
  229. /*
  230. ** Context functions
  231. */
  232. extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share);
  233. extern GLboolean aglDestroyContext(AGLContext ctx);
  234. extern GLboolean aglCopyContext(AGLContext src, AGLContext dst, GLuint mask);
  235. extern GLboolean aglUpdateContext(AGLContext ctx);
  236.  
  237. /*
  238. ** Current state functions
  239. */
  240. extern GLboolean aglSetCurrentContext(AGLContext ctx);
  241. extern AGLContext aglGetCurrentContext(void);
  242.  
  243. /*
  244. ** Drawable Functions
  245. */
  246. extern GLboolean aglSetDrawable(AGLContext ctx, AGLDrawable draw);
  247. extern GLboolean aglSetOffScreen(AGLContext ctx, GLsizei width, GLsizei height, GLsizei rowbytes, GLvoid *baseaddr);
  248. extern GLboolean aglSetFullScreen(AGLContext ctx, GLsizei width, GLsizei height, GLsizei freq, GLint device);
  249. extern AGLDrawable aglGetDrawable(AGLContext ctx);
  250.  
  251. /*
  252. ** Virtual screen functions
  253. */
  254. extern GLboolean aglSetVirtualScreen(AGLContext ctx, GLint screen);
  255. extern GLint aglGetVirtualScreen(AGLContext ctx);
  256.  
  257. /*
  258. ** Obtain version numbers
  259. */
  260. extern void aglGetVersion(GLint *major, GLint *minor);
  261.  
  262. /*
  263. ** Global library options
  264. */
  265. extern GLboolean aglConfigure(GLenum pname, GLuint param);
  266.  
  267. /*
  268. ** Swap functions
  269. */
  270. extern void aglSwapBuffers(AGLContext ctx);
  271.  
  272. /*
  273. ** Per context options
  274. */
  275. extern GLboolean aglEnable(AGLContext ctx, GLenum pname);
  276. extern GLboolean aglDisable(AGLContext ctx, GLenum pname);
  277. extern GLboolean aglIsEnabled(AGLContext ctx, GLenum pname);
  278. extern GLboolean aglSetInteger(AGLContext ctx, GLenum pname, const GLint *params);
  279. extern GLboolean aglGetInteger(AGLContext ctx, GLenum pname, GLint *params);
  280.  
  281. /*
  282. ** Font function
  283. */
  284. extern GLboolean aglUseFont(AGLContext ctx, GLint fontID, Style face, GLint size, GLint first, GLint count, GLint base);
  285.  
  286. /*
  287. ** Error functions
  288. */
  289. extern GLenum aglGetError(void);
  290. extern const GLubyte *aglErrorString(GLenum code);
  291.  
  292. /*
  293. ** Soft reset function
  294. */
  295. extern void aglResetLibrary(void);
  296.  
  297.  
  298. #ifdef __cplusplus
  299. }
  300. #endif
  301.  
  302. #endif /* _AGL_H */
  303.